package com.gt.admin.controller;

import com.gt.common.core.controller.BaseController;
import com.gt.common.core.domain.AjaxResult;
import com.gt.admin.domain.MenuFirst;
import com.gt.admin.service.IMenuFirstService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "sc-一级目录")
@RestController
@RequestMapping("/firstMenu")
public class MenuFirstController extends BaseController {
    @Autowired
    private IMenuFirstService menuFirstService;

    //获取树状列表
    @ApiOperation("获取树状列表")
    @GetMapping
    public AjaxResult list(MenuFirst menuFirst){
        List<MenuFirst> menuFirsts = menuFirstService.selectList(menuFirst);
        return AjaxResult.success(menuFirstService.buildMenuTree(menuFirsts));
    }
}
